﻿namespace Example.Cryptography
{
    using System;
    using System.Text;

    using Xunit;

    public class TripleDesPlaintextFacts
    {
        [Fact]
        public void ctor_byte()
        {
            Assert.NotNull(new TripleDesPlaintext(new byte[]
                                                      {
                                                          1, 2, 3
                                                      }));
        }

        [Fact]
        public void ctor_byteEmpty()
        {
            Assert.NotNull(new TripleDesPlaintext(new byte[]
                                                      {
                                                      }));
        }

        [Fact]
        public void ctor_byteNull()
        {
            Assert.Throws<ArgumentNullException>(() => new TripleDesPlaintext(null as byte[]));
        }

        [Fact]
        public void ctor_string()
        {
            Assert.NotNull(new TripleDesPlaintext("test"));
        }

        [Fact]
        public void ctor_stringEmpty()
        {
            Assert.NotNull(new TripleDesPlaintext(string.Empty));
        }

        [Fact]
        public void ctor_stringNull()
        {
            Assert.Throws<ArgumentNullException>(() => new TripleDesPlaintext(null as string));
        }

        [Fact]
        public void op_ToBytes()
        {
            var expected = Encoding.UTF8.GetBytes("test");
            var actual = new TripleDesPlaintext(expected).ToBytes();

            Assert.Equal(expected, actual);
        }

        [Fact]
        public void op_ToString()
        {
            const string expected = "test";
            var actual = new TripleDesPlaintext(expected).ToString();

            Assert.Equal(expected, actual);
        }
    }
}